package com.henu.engineer.dao.mapper.student

import com.henu.engineer.dao.entity.student.StudentScore
import com.henu.engineer.dao.entity.student.StudentScoreDtl
import org.apache.ibatis.annotations.Mapper
import org.springframework.stereotype.Repository

/**
 * 学生试卷得分明细表
 *
 * @author noexcept
 * @date 2021/7/27 21:17
 */
@Mapper
@Repository
interface StudentScoreDtlXmlMapper {
    fun insertSingle(studentScoreDtl: StudentScoreDtl): Boolean
    fun insertList(scoreDtlList: List<StudentScoreDtl>): Int
    fun deleteSingle(studentId: String, testPaperId: String, questionNum: String): Boolean

    /**
     * 更新某学生的某试卷的某一题的分数
     */
    fun updateSingle(studentId: String, testPaperId: String, questionNum: String, score: Double): Boolean

//    /**
//     * 查询，某学生某试卷所有题的得分
//     * @param studentId
//     * @param testPaperId
//     * @return 键为题号，值为分数
//     */
//    fun selectQuestionNumAndScore(studentId: String, testPaperId: String): List<Map<String, Double>>

    /**
     * 查询某试卷试卷某一题所有学生的分数
     * @param testPaperId
     * @param questionNum
     * @return 返回值StudentScoreDtl中的testPaperId和questionNum为NULL
     */
    fun selectByTestPaperAndQuestionNum(testPaperId: String, questionNum: String): List<StudentScoreDtl>

    fun selectByStudentIdTestPaperId(studentId: String, testPaperId: String): List<StudentScore>
}